<?php


$server=new swoole\http\server("0.0.0.0",9503);

//swoole会开辟一个协程栈,对协程栈进行初始化
$server->on('request',function(){

  /* $config['db']=[
        'dsn'=>'mysql:host=localhost;dbname=test',
        'user'=>'root',
        'password'=>'Qq!990979940'
    ];
    $pdo=new PDO($config['db']['dsn'],$config['db']['user'],$config['db']['password']);
    $pdo->query('select sleep(1)');
  */


    $swoole_mysql = new Co\MySQL();
    $swoole_mysql->connect([
        'host' => '127.0.0.1',
        'port' => 3306,
        'user' => 'root',
        'password' => 'Qq!990979940',
        'database' => 'test',
    ]);


    //收包
    $res = $swoole_mysql->query('select sleep(1)');
    $swoole_mysql->close();
    var_dump($res);


    //并发能力



});


$server->start();



